<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS没有块级作用域</title>
  </head>

  <body>

  </body>
  <script>
    /* 
    JS没有块级作用域
    1.ES6里新增了块级作用域
    2.别的语言Java，C都会有块级作用域
    */
    if (true) {
      var name = "pink";
    }
    console.log(name); //pink
  </script>

</html>